package mspbots.autotask.client.core.data.billingcodes;

import com.fasterxml.jackson.databind.JsonNode;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import mspbots.autotask.common.QueryBody;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono;

import javax.validation.Valid;
import java.net.URI;

@Log4j2
@RestController
@RequestMapping("billing-codes/{tenantId}")
@RequiredArgsConstructor
public class BillingCodesController {
    private final BillingCodesServiceImpl BillingCodesService;

    @PostMapping("find")
    public Mono<JsonNode> find(@PathVariable Long tenantId,
                               @Valid @RequestBody QueryBody queryBody,
                               @RequestParam(required = false) URI pageUrl) {
        return this.BillingCodesService.find(tenantId, queryBody, pageUrl);
    }

    @PostMapping("count")
    public Mono<JsonNode> count(@PathVariable Long tenantId,
                                @Valid @RequestBody QueryBody queryBody) {
        return this.BillingCodesService.count(tenantId, queryBody);
    }

}
